<?php
/**
 * VIP会员API验证器
 * @author 王勇程 <laughskydragon@qq.com>
 */

namespace app\api\validate;

use think\Validate;

class Vip extends Validate
{
    protected $rule = [
        'user_token' => 'require',
        'package_id' => 'require|integer|gt:0',
        'order_no' => 'require',
        'payment_method' => 'require',
        'page' => 'integer|egt:1',
        'limit' => 'integer|between:1,100'
    ];
    
    protected $message = [
        'user_token.require' => '用户token不能为空',
        'package_id.require' => '套餐ID不能为空',
        'package_id.integer' => '套餐ID必须为整数',
        'package_id.gt' => '套餐ID必须大于0',
        'order_no.require' => '订单号不能为空',
        'payment_method.require' => '支付方式不能为空',
        'page.integer' => '页码必须为整数',
        'page.egt' => '页码必须大于等于1',
        'limit.integer' => '每页数量必须为整数',
        'limit.between' => '每页数量必须在1-100之间'
    ];
    
    protected $scene = [
        'create_order' => ['user_token', 'package_id'],
        'payment' => ['order_no', 'payment_method'],
        'history' => ['user_token', 'page', 'limit']
    ];
}